package cn.demoncat.util.web.convert;

import org.springframework.format.FormatterRegistry;

/**
 * 参数转换器
 *
 * @author 延晓磊
 * @since 2024年10月15日
 */
public class ConvertUtil {

    /**
     * 添加参数转换器
     *
     * 场景：WebMvcConfigurer.addFormatters
     *
     * @param registry
     */
    public static void addFormatters(FormatterRegistry registry) {
        registry.addConverter(new StringConvert());
        registry.addConverter(new DateConvert());
        registry.addConverter(new LocalDateTimeConvert());
        registry.addConverter(new LocalDateConvert());
        registry.addConverter(new LocalTimeConvert());
        registry.addConverter(new LongConvert());
        registry.addConverter(new IntegerConvert());
        registry.addConverter(new ShortConvert());
        registry.addConverter(new ByteConvert());
        registry.addConverter(new BigDecimalConvert());
        registry.addConverter(new DoubleConvert());
        registry.addConverter(new FloatConvert());
    }
}
